using UnityEngine;
using System.Collections;
using System.Collections.Generic;


public class MenuPrincipal : MenuModel {

    private HUDButton _btnPlay;
    private HUDButton _btnSettings;
    private HUDButton _btnCredits;
    private HUDButton _btnQuit;

	void Start()
    {
        AffectButtons();
    }

    //Get Buttons
    void AffectButtons()
    {
        foreach (HUDButton button in _listButtons)
        {

            if (button.name == "playBtn")
            {
                _btnPlay = button;
            }
            else if (button.name == "optionsBtn")
            {
                _btnSettings = button;
            }
            else if (button.name == "creditsBtn")
            {
                _btnCredits = button;
            }
            else if (button.name == "quitBtn")
            {
                _btnQuit = button;
            }

        }
    }

    public override void OnRelease(object o)
    {
        base.OnRelease(o);
        //Check release button
        foreach (HUDButton button in _listButtons)
        {
            if (button == o)
            {
                if (button == _btnPlay)
                    SwitchSceneManager.Instance.SwitchToScene("Level1");
                else if (button == _btnCredits)
                    SwitchSceneManager.Instance.SwitchToScene("CreditsMenu");
                else if (button == _btnSettings)
                    SwitchSceneManager.Instance.SwitchToScene("Settings");
                else if (button == _btnQuit)
                    Application.Quit();
            }
        }

    }
	
}
